package com.xtsoft.platform.report;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

/*
    repository由多数据源配置进行扫描注入，因此主启动类此处注释掉。
 */
//@EnableJpaRepositories(repositoryFactoryBeanClass = CommonRepositoryFactoryBean.class, basePackages = {"com.xtsoft.platform.base.system.repository" })
@SpringBootApplication(scanBasePackages = "com",exclude = {org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration.class,org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration.class})
@Slf4j

public class XtsoftBusinessApplication {


    public static void main(String[] args) throws UnknownHostException {
        SpringApplication application = new SpringApplication(XtsoftBusinessApplication.class);
        Environment env = application.run(args).getEnvironment();
        String protocol = "http";
        if (env.getProperty("server.ssl.key-store") != null) {
            protocol = "https";
        }

        log.info("\n----------------------------------------------------------\n\t" +
                        "应用 '{}' 运行! 请访问 URLs:\n\t" +
                        "本地访问: \t{}://localhost:{}\n\t" +
                        "外部访问: \t{}://{}:{}\n\t" +
                        "配置文件: \t{}\n----------------------------------------------------------",
                env.getProperty("spring.application.name"),
                protocol,
                env.getProperty("server.port"),
                protocol,
                InetAddress.getLocalHost().getHostAddress(),
                env.getProperty("server.port"),
                env.getActiveProfiles());
    }

}
